home *** CD-ROM | disk | FTP | other *** search
- Path: inforamp.net!ts16-02
- From: rmorin@inforamp.net (Randy Charles Morin)
- Newsgroups: comp.lang.c++
- Subject: Re: Persistent Objects
- Date: Sat, 16 Mar 96 18:53:59 GMT
- Organization: MiddleWorld SoftWare
- Message-ID: <4if2op$578@sam.inforamp.net>
- References: <4i50ja$2lu@atlantis.cc.uwf.edu>
- NNTP-Posting-Host: ts16-02.tor.inforamp.net
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- In article <4i50ja$2lu@atlantis.cc.uwf.edu>,
- dwelch@news.uwf.edu (dale welch) wrote:
- >
- > This may be a really trivial thing, but i am doing a project
- > that requires persistent objects to be used, and was wondering if
- > there was a good example of this kind of implementation. I know the
- > basic theory behind the problem, but to see a working example of
- > a basic program, no matter what its size would really be helpful.
- > Well, thanks for any suggestions or pointers...
- >
- > dale
-
- class PersistentObject
- {
- private:
- int i;
- public:
- PersistentObject();
- ~PersistentObject();
- };
-
- PersistentObject::PersistentObject()
- {
- ifstream is(FILENAME.EXT);
- is >> i;
- }
-
- PersistentObject::~PersistentObject()
- {
- ofstream os(FILENAME.EXT);
- os << i;
- }
-
- A very simplistic example.
-
- Agrivar
-